//封装和用户相关接口函数
import request from "@/utils/http";

/**
 * 登录
 * @param phone
 * @param password
 */
export const loginAPI = ({ phone, password }) => {
  return request({
    url: "/user/login",
    method: "POST",
    data: {
      phone,
      password,
    },
  });
};

/**
 * 注册
 * @param phone
 * @param password
 * @param confirmPassword
 */
export const registerAPI = (data) => {
  return request({
    headers: {
      "Content-Type": "multipart/form-data",
    },
    url: "/user/register",
    method: "POST",
    data,
  });
};

/**
 * 根据id查一个
 * @param phone
 * @param password
 */
export const getOneAPI = (id) => {
  return request({
    url: "/user/userById",
    params: { id: id },
    method: "GET",
  });
};

/**
 * 退出
 * @param phone
 * @param password
 */
export const loginOutAPI = () => {
  return request({
    url: "/user/logout",
    method: "POST",
  });
};
